package com.ktwlsoft.archivemanage.domain.dao.repository;

import com.ktwlsoft.archivemanage.domain.dao.entity.Report;
import com.ktwlsoft.archivemanage.domain.dao.entity.ReportDetail;
import com.ktwlsoft.archivemanage.payload.annualReport.ReportResponse;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.time.Year;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 年度报送Mapper接口
 * @author chenkun
 * @version 1.o
 */
@Mapper
@Repository
public interface IReportMapper {
    /**
     * 查询列表 on 2019-10-24 14:19:42
     * @param report report
     * @return List<Report>
     */
    List<Report> findList(Report report);

    /**
     * 根据id查询信息 on 2019-10-24 14:19:42
     * @param id id
     * @return Report
     */
    Report getById(Long id);

    /**
     * 根据id删除信息 on 2019-10-24 14:19:42
     * @param id id
     * @return int
     */
    int deleteById(Long id);

    /**
     * 根据id集合批量删除信息 on 2019-10-24 14:19:42
     * @param ids ids
     * @return int
     */
    int deleteByIds(List<Long> ids);

    /**
     * 插入 on 2019-10-24 14:19:42
     * @param report report
     * @return int
     */
    int insert(Report report);

    /**
     * 更新 on 2019-10-24 14:19:42
     * @param report report
     * @return int
     */
    int update(Report report);

    /**
     * 查询年度报送列表
     * @param data
     * @return List<ReportDetail>
     */
    List<ReportDetail> findAnnualReportList(Map<String,Object> data);

    /**
     * 查询已有年度报送列表
     * @param data
     * @return List<ReportDetail>
     */
    List<ReportResponse> findExistedReportList(Map<String,Object> data);

    /**
     * 查询年度报送列表
     * @param data
     * @return List<Map<String,Object>>
     */
    List<Map<String,Object>> fetchAnnualReportList(Map<String,Object> data);

    /**
     * 根据id查询年度报送信息
     * @param id
     * @return ReportDetail
     */
    ReportDetail findAnnualReportInfo(Long id);

    /**
     * 根据id查询年度报送信息
     * @param report
     * @return ReportDetail
     */
    ReportDetail findAnnualReportDetail(Report report);

    /**
     * 更新年度报送信息
     * @param report
     * @return
     */
    int updateAnnualReportInfo(Report report);

    /**
     * 新增年度报送信息
     * @param report
     * @return int
     */
    int addAnnualReportInfo(Report report);

    int setTransfered(Long businessId, String realName, Long userId, Date date, String transferRemark);

    int cancelTransfered(Long businessId, String realName, Long userId, Date date, String transferRemark);

    Long existByUnitIdYear(Long unitId, Year writeDate);

    int setInvalidByUnitIdAndYear(Long unitId, Year writeDate, boolean valid);

    int setCompareConfirm(Long unitId, Year year, boolean compare);
}
